package com.org;

import java.io.Serializable;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
public class ProducerTest {
public static void main(String[] args) throws JMSException {
	ConnectionFactory  factory=new ActiveMQConnectionFactory("failover://tcp://127.0.0.1:61616");
	Connection con=factory.createConnection();
	con.start();
	Session session=con.createSession(false,Session.AUTO_ACKNOWLEDGE);
	Queue queue=session.createQueue("mao");
	MessageProducer  producer=session.createProducer(queue);
	for(int i=0;i<10;i++){
		Customer c=new Customer();
		c.setAge(i);
        c.setName("mao"+i);
        ObjectMessage msg=session.createObjectMessage(c);
	  producer.send(msg);
	}
	con.stop();
	con.close();	
}
}
